package org.microsites.domain.model;

public class Server implements Entity {
	public static enum Type {
		WWW(80), J2EE(8080), DBMS(1433), SVN(80), SMTP(25), POP3(110), IMAP(143), FTP(21), Samba(445), NFS(2049), SSH(22);
		
		private int port;
		private Type(int port) {
			this.port = port;
		}
		
		public int getPort() {return this.port;}
	}

	private Type type;
	private String name;
	private String version;
	private String description;
	private String path;
	private String dataPath;
	private String service;
	private Long host;
	private Integer port;
	private Long admin;
	private Long id;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getDataPath() {
		return dataPath;
	}

	public void setDataPath(String dataPath) {
		this.dataPath = dataPath;
	}

	public String getService() {
		return service;
	}

	public void setService(String service) {
		this.service = service;
	}

	public Long getHost() {
		return host;
	}

	public void setHost(Long host) {
		this.host = host;
	}

	public Integer getPort() {
		if (port == null && type != null) port = type.getPort(); 
		return port;
	}

	public void setPort(Integer port) {
		if (port == null && type != null) port = type.getPort();
		this.port = port;
	}

	public Long getAdmin() {
		return admin;
	}

	public void setAdmin(Long admin) {
		this.admin = admin;
	}

}
